//
//  DateUtils.m
//  youwei
//
//  Created by 王昭 on 2017/6/23.
//  Copyright © 2017年 xiaoningmeng. All rights reserved.
//

#import "DateUtil.h"

@implementation DateUtil

#pragma mark - 获取当前日期字符串（带格式）
+ (NSString *)requireFormatDate:(NSString *)format
{
    NSDate *date = [NSDate date];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = format;
    return [formatter stringFromDate:date];
}

#pragma mark - 根据时间戳获取时间字符串
+ (NSString *)requireDateStringFromTimeSwamp:(NSTimeInterval)interval format:(NSString *)format
{
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = format;
    return [formatter stringFromDate:date];
}

#pragma mark - 获取当前的时间戳
+ (NSString *)requireCurrentTimeSwamp
{
    return [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]];
}




@end
